package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.Observable;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class DetailsView extends JInternalFrame implements IView{

	public final int OPTIONS_PREF_WIDTH = 250, OPTIONS_PREF_HEIGHT = 300;
	static public JTextArea textAreaArtistDetail;
	static public JLabel artistOverNameLabel;
	private JComboBox box;
	private JPanel panel;
	public PieChart pc;
	
	public DetailsView(String title){
		super(title);
		display();
	}
	
	@Override
	public void update(Observable o, Object arg) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void display() {		

		setClosable(false);
		setPreferredSize(new Dimension(OPTIONS_PREF_WIDTH, OPTIONS_PREF_HEIGHT));
		setResizable(false);
		
		panel = new JPanel();
		panel.setBackground(Color.WHITE);
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		
		JPanel panelNorth= new JPanel();
		panelNorth.setBackground(Color.WHITE);
		panelNorth.setLayout(new BoxLayout(panelNorth, BoxLayout.Y_AXIS));
		JLabel aristOverLabel= new JLabel("Artist Over:");
		aristOverLabel.setAlignmentX(RIGHT_ALIGNMENT);
		artistOverNameLabel = new JLabel("");
		artistOverNameLabel.setAlignmentX(RIGHT_ALIGNMENT);
		panelNorth.add(aristOverLabel);
		panelNorth.add(artistOverNameLabel);
		

		JPanel panelMiddle= new JPanel();
		panelMiddle.setBackground(Color.WHITE);
		panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.Y_AXIS));
		panelMiddle.setPreferredSize(new Dimension (100,250));
		textAreaArtistDetail= new JTextArea("");
		textAreaArtistDetail.setEditable(false);
		JScrollPane jpTextArea = new JScrollPane(textAreaArtistDetail);
		JLabel aristLabel= new JLabel("Artist Details:");
		aristLabel.setAlignmentX(RIGHT_ALIGNMENT);
		panelMiddle.add(aristLabel);
		panelMiddle.add(jpTextArea);

		
		JPanel panelSouth= new JPanel();
		panelSouth.setPreferredSize(new Dimension (100,250));
		panelSouth.setLayout(new BoxLayout(panelSouth, BoxLayout.Y_AXIS));
		panelSouth.setBackground(Color.WHITE);
		pc= new PieChart();
		JLabel pieChartLabel= new JLabel("Style influencer(s) distribution:");
		pieChartLabel.setAlignmentX(RIGHT_ALIGNMENT);
		panelSouth.add(pieChartLabel);
		panelSouth.add(pc);
		getContentPane().add(new JScrollPane(panelSouth));
		
		

		panel.add(panelNorth);
		panel.add(new JSeparator(SwingConstants.HORIZONTAL));
		panel.add(panelMiddle);
		panel.add(new JSeparator(SwingConstants.HORIZONTAL));
		panel.add(panelSouth);
		getContentPane().add(new JScrollPane(panel));

		setVisible(true);
	}



	public JPanel getPanel() {
		return panel;
	}

	public void setPanel(JPanel panel) {
		this.panel = panel;
	}

	public JComboBox getBox() {
		return box;
	}

	public void setBox(JComboBox box) {
		this.box = box;
	}

	
}
